name: Deployment

on:
  push:
    branches: [main]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - name: executing remote ssh commands
      uses: appleboy/ssh-action@v1.0.0
      with:
        host: ${{ secrets.HOST }}
        username: ${{ secrets.USER }}
        key: ${{ secrets.PRIVATE_KEY }}
        port: ${{ secrets.PORT }}
        script: |
          cd time
          git pull
          git status
          export NVM_DIR=~/.nvm
          source ~/.nvm/nvm.sh
          npm ci
          pm2 restart app.js
